Fix for SQL Server import error when restoring BACPAC file to SSMS
Encountered an error while importing the Database (.bacpac) file into SQL Server Management Studio (SSMS).
Download the .bacpac file from LCS (Lifecycle Services).
Create a copy of the BACPAC file and store it in a separate folder.
Right-click the file and rename it from .bacpac to .zip.
Extract the ZIP file and locate the model.xml file.
Move it to another folder for editing.
In model.xml, remove the
<Element> entry for
Grant.KillDatabaseConnection.Database
from both “ms_db_configreader” and
“ms_db_configwriter” sections.
Save the modified model.xml file.
Open Command Prompt as Administrator and run:
SqlPackage.exe /a:import /sf:J:\Testbackup.bacpac /mfp:E:\model.xml \
/tsn:localhost /tdn:AxDB_20240515 /p:CommandTimeout=12000 /ttsc:True
/mfp refers to /ModelFilePath — provide the path of the edited
model.xml file.
The .bacpac file will now import successfully into SSMS without the permission error.